import request from '@/utils/request'

// 售卖记录相关API接口

/**
 * 添加售卖记录
 */
export function addSalesRecord(data) {
  return request({
    url: '/api/sales/record',
    method: 'post',
    data
  })
}

/**
 * 分页查询售卖记录
 */
export function getSalesRecordPage(params) {
  return request({
    url: '/api/sales/records',
    method: 'get',
    params
  })
}

/**
 * 根据ID查询售卖记录详情
 */
export function getSalesRecordById(id) {
  return request({
    url: `/api/sales/record/${id}`,
    method: 'get'
  })
}

/**
 * 取消售卖记录
 */
export function cancelSalesRecord(id) {
  return request({
    url: `/api/sales/record/${id}/cancel`,
    method: 'put'
  })
}

/**
 * 导出售卖记录
 */
export function exportSalesRecords(params) {
  return request({
    url: '/api/sales/export',
    method: 'get',
    params
  })
}

/**
 * 根据商品ID查询售卖记录
 */
export function getSalesRecordsByProductId(productId) {
  return request({
    url: `/api/sales/records/product/${productId}`,
    method: 'get'
  })
}

/**
 * 获取当前店长的售卖记录
 */
export function getMySalesRecords() {
  return request({
    url: '/api/sales/my-records',
    method: 'get'
  })
} 